<template>
  <div>
     <el-form
        ref="dicTypeForm"
        :rules="rules"
        :model="dicTypInfo"
        label-position="right"
        label-width="120px"
      >
        <el-row>
          <el-col :span="10">
            <el-form-item label="🍁姓名">
              <el-input v-model="dicTypInfo.e_name"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="🍁政治面貌">
              <el-input v-model="dicTypInfo.e_politics_status"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="10">
            <el-form-item label="🍁手机号">
              <el-input v-model="dicTypInfo.e_phone"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="🍁院校">
              <el-input v-model="dicTypInfo.e_academy"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="10">
            <el-form-item label="🍁专业">
              <el-input v-model="dicTypInfo.e_major"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="🍁家庭住址">
              <el-input v-model="dicTypInfo.e_family"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="10">
            <el-form-item label="民族">
              <el-input v-model="dicTypInfo.e_nation"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="籍贯">
              <el-input v-model="dicTypInfo.e_native_place"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="10">
            <el-form-item label="婚姻">
              <el-input v-model="dicTypInfo.e_marriage"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="入职日期">
              <el-date-picker
                type="date"
                placeholder="入职日期"
                v-model="dicTypInfo.e_datetime"
                style="width: 100%"
              ></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="10">
            <el-form-item label="邮箱">
              <el-input v-model="dicTypInfo.e_emailes"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="身份证号">
              <el-input v-model="dicTypInfo.e_identity"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <!-- dialogStatus === '1' 是添加 就执行添加的方法  是修改  就执行修改的方法-->
        <el-button
          type="primary"
          @click="dialogStatus === '1' ? addDictType() : updateDictType()"
        >
          保存
        </el-button>
        <el-button @click="dialogFormVisible = false"> 取消 </el-button>
      </div>
  </div>
</template>

  <script>
import { dttCreated } from "@/api/system_base/Employee_registration";

export default {
  data() {
    return {
      dialogStatus: "1", // 等于1 表示是添加操作   不等于1 表示修改操作
      dicTypInfo: {},
    };
  },
  created() {
    this.resetDicinfo();
  },
  methods: {
    addDictType() {
      //添加方法
      this.$refs["dicTypeForm"].validate((valid) => {
        if (valid) {
          dttCreated(this.dicTypInfo).then((response) => {
            this.$router.push("/dtt");
            this.$notify({
              title: "添加成功",
              message: "添加员工信息成功",
              type: "success",
              duration: 2000,
            });
          });
        }
      });
    },
    resetDicinfo() {
      // 初始化用户对象
      this.dicTypInfo = {
        e_name: "",
        e_politics_status: "",
        e_phone: "",
        e_academy: "",
        e_major: "",
        e_family: "",
        e_nation: "",
        e_native_place: "",
        e_marriage: "",
        e_emailes: "",
        e_identity: "",
        e_datetime: "",
      };
    },
  },
};
</script>

<style >
.search_input {
  width: 200px;
}
</style>